package smartrpc.boot.starter.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Created By gao_e on 2020/3/7 21:22
 */
@ConfigurationProperties(prefix = "rpcserver")
public class SmartRPCProperties {

    // RPC服务端端口
    private int smartRPCServerPort = 8080;
    // 是否开启RPC服务端，提供服务
    private boolean openSmartRPCServer = true;
    // 注册中心暂时用文件来替代
    private String registHost = "D:/repository.txt";
    // 是否需要注册服务到注册中心
    private boolean needRegist = true;
    // 是否作为客户端，要访问其它的RPC server
    private boolean needRequestOtherRPCServer = true;

    public boolean isNeedRequestOtherRPCServer() {
        return needRequestOtherRPCServer;
    }

    public void setNeedRequestOtherRPCServer(boolean needRequestOtherRPCServer) {
        this.needRequestOtherRPCServer = needRequestOtherRPCServer;
    }

    public boolean isNeedRegist() {
        return needRegist;
    }

    public void setNeedRegist(boolean needRegist) {
        this.needRegist = needRegist;
    }

    public String getRegistHost() {
        return registHost;
    }

    public void setRegistHost(String registHost) {
        this.registHost = registHost;
    }

    public int getSmartRPCServerPort() {
        return smartRPCServerPort;
    }

    public void setSmartRPCServerPort(int smartRPCServerPort) {
        this.smartRPCServerPort = smartRPCServerPort;
    }

    public boolean isOpenSmartRPCServer() {
        return openSmartRPCServer;
    }

    public void setOpenSmartRPCServer(boolean openSmartRPC) {
        this.openSmartRPCServer = openSmartRPC;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("SmartRPCProperties{");
        sb.append("smartRPCServerPort=").append(smartRPCServerPort);
        sb.append(", openSmartRPCServer=").append(openSmartRPCServer);
        sb.append(", registHost='").append(registHost).append('\'');
        sb.append(", needRegist=").append(needRegist);
        sb.append(", needRequestOtherRPCServer=").append(needRequestOtherRPCServer);
        sb.append('}');
        return sb.toString();
    }
}
